#include "SoundPotVstInstrumentFactory.h"


SoundPot::VstInstrumentFactory* SoundPot::VstInstrumentFactory::instance;

SoundPot::VstInstrumentFactory::VstInstrumentFactory()
{
}

SoundPot::VstInstrumentFactory::~VstInstrumentFactory()
{
	
}

SoundPot::VstInstrumentFactory* SoundPot::VstInstrumentFactory::getInstance()
{
	return SoundPot::VstInstrumentFactory::instance;
}

VstIntPtr VSTCALLBACK SoundPot::VstInstrumentFactory::pluginToHostCallback (AEffect* effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt)
{
	VstIntPtr result = 0;


	// Filter idle calls...
	bool filtered = false;
	if (opcode == audioMasterIdle)
	{
		static bool wasIdle = false;
		if (wasIdle)
			filtered = true;
		else
		{
			wasIdle = true;
		}
	}


	switch (opcode)
	{
		case audioMasterVersion :
			result = kVstVersion;
			break;
	}

	return result;
}

VstIntPtr VSTCALLBACK SoundPot::VstInstrumentFactory::staticPluginToHostCallback (AEffect* effect, VstInt32 opcode, VstInt32 index, VstIntPtr value, void* ptr, float opt)
{
	// Forward to object method
	return SoundPot::VstInstrumentFactory::getInstance()->pluginToHostCallback(effect, opcode, index, value, ptr, opt);
}